$(function (){
    let phone=localStorage.getItem("phone")
    $.ajax({
        url: `http://localhost:8088/dev/user/head/${phone}`,
        type: 'post',
        success:function (result){
            if(phone!=null){
                let arr = result.data
                console.log(arr)
                let str=`<img src= "${arr.uphoto}" class="img-fluid" alt="">`
                $("#photo").html(str)
                let uname=`${arr.username}`
                $("#uname").html(uname)
                let intro=`${arr.intro}`
                $("#intro").html(intro)
            }else{
                let str=`<img src="#" >`
                $("#photo").html(str)
                let uname=`<a href="/dev/views/slx/login.html" style="color: whitesmoke">请先登录</a>`
                $("#uname").html(uname)
                let intro="请先登录"
                $("#intro").html(intro)
            }
        }
    })
})



function selectPrice(priceType) {
    var priceBoxes = document.getElementsByClassName('price-box');
    for (var i = 0; i < priceBoxes.length; i++) {
        priceBoxes[i].classList.remove('selected');
    }

    var selectedPriceBox = document.getElementById(priceType);
    selectedPriceBox.classList.add('selected');
}

function selectPaymentOption(paymentType) {
    var paymentOptions = document.getElementsByClassName('payment-option');
    for (var i = 0; i < paymentOptions.length; i++) {
        paymentOptions[i].classList.remove('selected');
    }

    var selectedPaymentOption = document.getElementById(paymentType);
    selectedPaymentOption.classList.add('selected');

    var qrcodes = document.getElementsByClassName('qrcode');
    for (var i = 0; i < qrcodes.length; i++) {
        qrcodes[i].style.display = 'none';
    }

    var selectedQRCode = document.getElementById(paymentType + '-qrcode');
    selectedQRCode.style.display = 'block';
}
function selectPaymentOption2(paymentType) {
    var paymentOptions = document.getElementsByClassName('payment-option');
    for (var i = 0; i < paymentOptions.length; i++) {
        paymentOptions[i].classList.remove('selected');
    }

    var selectedPaymentOption = document.getElementById(paymentType);
    selectedPaymentOption.classList.add('selected');

    var qrcodes = document.getElementsByClassName('qrcode2');
    for (var i = 0; i < qrcodes.length; i++) {
        qrcodes[i].style.display = 'none';
    }

    var selectedQRCode = document.getElementById(paymentType + '-qrcode2');
    selectedQRCode.style.display = 'block';
}


function selectPaymentOption3(paymentType) {
    var paymentOptions = document.getElementsByClassName('payment-option');
    for (var i = 0; i < paymentOptions.length; i++) {
        paymentOptions[i].classList.remove('selected');
    }

    var selectedPaymentOption = document.getElementById(paymentType);
    selectedPaymentOption.classList.add('selected');

    var qrcodes = document.getElementsByClassName('qrcode3');
    for (var i = 0; i < qrcodes.length; i++) {
        qrcodes[i].style.display = 'none';
    }

    var selectedQRCode = document.getElementById(paymentType + '-qrcode3');
    selectedQRCode.style.display = 'block';
}

var monthlyPrice = 9;
var monthlyPrice2 = 14;
var yearlyPrice = 88;
var yearlyPrice2 = 118;
var allPrice = 368;

var alipayPriceElement = document.getElementById('alipay-price');
var alipayPriceElement2 = document.getElementById('alipay-price2');
var alipayPriceElement3 = document.getElementById('alipay-price3');

alipayPriceElement.innerText = '价格：￥' + monthlyPrice + ' / ￥' + yearlyPrice;

alipayPriceElement2.innerText = '价格：￥' + monthlyPrice2 + ' / ￥' + yearlyPrice2;


alipayPriceElement3.innerText = '价格：￥' + allPrice ;
